{% extends 'template.html' %}

{% block username %}
    {{ head.username }}
{% endblock %}

{% block content %}
    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">{{ head.value }}</h1>
            </div>
        </div>
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <div class="btn-group">
                            <!--<a><button id='bt-add' type="button" class="btn btn-primary">增加</button></a>-->
                            <!--<a><button id='bt-del' data-text="确定删除主机? 0个" type="button" class="btn btn-danger">删除</button></a>-->
                            <a>
                                <button id='bt-search' type="button" class="btn btn-success">高级搜索</button>
                            </a>
                            <a>
                                <button id='bt-reset' type="button" class="btn btn-danger">重置高级搜索</button>
                            </a>
                            <a>
                                <button id='bt-print' type="button" class="btn btn-info">生成打印单</button>
                            </a>
                            <!--<a href="/it_assets/download/"><button id='bt-download' type="button" class="btn btn-primary">导出excel</button></a>-->
                        </div>
                    </div>
                    <div class="panel-body">
                        <div id="div-search" class="hide">
                            <table id="high-search" style="width: 67%; margin: 0 auto 2em auto;" border="0"
                                   cellpadding="3"
                                   cellspacing="0">
                                <thead>
                                <tr>
                                    <th>目标</th>
                                    <th>内容</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr id="_filter_ctype" data-column="2">
                                    <td>类别</td>
                                    <td align="center">
                                        <select id="filter_ctype" style="width: 100%">
                                            <option value="100" selected="selected">全部</option>
                                            <option value="0">电子设备</option>
                                            <option value="1">其他电子设备</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_company" data-column="5">
                                    <td>公司</td>
                                    <td align="center">
                                        <select id="filter_company" class="filter_select2" style="width: 100%">
                                            <option value="0" selected="selected">全部</option>
                                            {% for company in all_company %}
                                                <option value={{ company.id }}>{{ company.text }}</option>
                                            {% endfor %}
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_assets_number" data-column="4">
                                    <td>资产编号</td>
                                    <td align="center"><input style="width:100%" class="column_filter"
                                                              id="filter_assets_number" type="text"></td>
                                </tr>
                                <tr id="_filter_name" data-column="5">
                                    <td>资产名称</td>
                                    <td align="center">
                                        <select id="filter_name" class="filter_select2" style="width: 100%">
                                            <option value="0" selected="selected">全部</option>
                                            {% for name in all_assets_name %}
                                                <option value={{ name }}>{{ name }}</option>
                                            {% endfor %}
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_brand" data-column="6">
                                    <td>品牌</td>
                                    <td align="center"><input style="width:100%" class="column_filter" id="filter_brand"
                                                              type="text"></td>
                                </tr>
                                <tr id="_filter_specification" data-column="6">
                                    <td>规格</td>
                                    <td align="center"><input style="width:100%" class="column_filter"
                                                              id="filter_specification" type="text"></td>
                                </tr>
                                <tr id="_filter_new_organization" data-column="2">
                                    <td>使用部门</td>
                                    <td align="center">
                                        <select id="filter_new_organization" class="filter_select2" style="width: 100%">
                                            <option value="0" selected="selected">全部</option>
                                            {% for new_organization in all_new_organization %}
                                                <option value={{ new_organization }}>{{ new_organization }}</option>
                                            {% endfor %}
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_user" data-column="2">
                                    <td>领用人</td>
                                    <td align="center">
                                        <select id="filter_user" class="filter_select2" style="width: 100%">
                                            <option value="0" selected="selected">全部</option>
                                            {% for user in all_user %}
                                                <option value={{ user.id }}>{{ user.name }}</option>
                                            {% endfor %}
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_status" data-column="2">
                                    <td>状态</td>
                                    <td align="center">
                                        <select id="filter_status" style="width: 100%">
                                            <option value="100" selected="selected">全部</option>
                                            <option value="0">库存</option>
                                            <option value="1">领用</option>
                                            <option value="2">外借</option>
                                            <option value="3">回收</option>
                                            <option value="4">损毁</option>
                                            <option value="5">清理</option>
                                            <option value="6">变卖</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_pos" data-column="2">
                                    <td>位置</td>
                                    <td align="center">
                                        <select id="filter_pos" style="width: 100%">
                                            <option value="0" selected="selected">全部</option>
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_supplier" data-column="2">
                                    <td>供应商</td>
                                    <td align="center">
                                        <select id="filter_supplier" class="filter_select2" style="width: 100%">
                                            <option value="0" selected="selected">全部</option>
                                            {% for supplier in all_supplier %}
                                                <option value={{ supplier.id }}>{{ supplier.name }}</option>
                                            {% endfor %}
                                        </select>
                                    </td>
                                </tr>
                                <tr id="_filter_remark" data-column="2">
                                    <td>备注</td>
                                    <td align="center">
                                        <input style="width:100%" class="column_filter" id="filter_remark" type="text">
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                        <table id="mytable" class="display" width="100%" cellspacing="0">
                            <thead>
                            <tr>
                                <th class="center sorting_disabled">
                                    <label class="pos-rel">
                                        <input id='chb-all' type="checkbox"/>
                                    </label>
                                </th>
                                <th>id</th>
                                <th>类别</th>
                                <th>所属公司</th>
                                <th>资产编号</th>
                                <th>资产名称</th>
                                <th>品牌</th>
                                <th>规格</th>
                                <th>使用部门</th>
                                <th>使用人</th>
                                <th>状态</th>
                                <th>位置</th>
                                <th>供应商</th>
                                <th>备注</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                        </table>
                    </div>
                </div>
            </div>
            <div class="modal fade" id="myModalEdit" role="dialog" aria-labelledby="myModalLabelEdit"
                 aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="myModalLabelEdit"></h4>
                        </div>
                        <div class="modal-body">
                            <div class="alert alert-danger alert-dismissable" id='modal-notify-edit'>
                                <button type="button" class="close" id="bt-modal-notify-edit">&times;</button>
                                <label id='lb-msg-edit'></label>
                            </div>
                            <div class="form-horizontal" role="form">
                                <div class="form-group" id='show_id'>
                                    <label class="col-sm-3 control-label">id</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control " placeholder="" id="id">
                                    </div>
                                </div>
                                <div class="form-group"
                                     style="display: {% if perms.it_assets.change_assets_company %}block{% else %}none{% endif %};">
                                    <label class="col-sm-3 control-label">所属公司</label>
                                    <div class="col-sm-8">
                                        <select id="company" style="width: 100%">
                                            <option selected="selected" value="0">选择所属公司</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group" id='show_id' style="display: none">
                                    <label class="col-sm-3 control-label">brand</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control " placeholder="" id="brand">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">规格</label>
                                    <div class="col-sm-8">
                                        <input type="text" class="form-control " placeholder="" id="specification">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">供应商</label>
                                    <div class="col-sm-8">
                                        <select id="supplier" style="width: 100%">
                                            <option selected="selected" value="0">选择供应商</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">使用人</label>
                                    <div class="col-sm-8">
                                        <select id="user" style="width: 100%">
                                            <option selected="selected" value="0">选择使用人</option>
                                        </select>
                                    </div>
                                </div>
                                <!--<div class="form-group">
                                    <label class="col-sm-3 control-label">使用部门</label>
                                    <div class="col-sm-8">
                                        <select id="new_organization" style="width: 100%">
                                            <option selected="selected" value="0">选择使用部门</option>
                                        </select>
                                    </div>
                                </div>-->
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">位置</label>
                                    <div class="col-sm-8">
                                        <select id="pos" style="width: 100%">
                                            <option selected="selected" value="0">选择位置</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-3 control-label">备注</label>
                                    <div class="col-sm-8">
                                        <textarea class="form-control" rows="5" placeholder="" id="remark"></textarea>
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                    <button id='bt-save' type="button" class="btn btn-primary">保存</button>
                                </div>
                            </div>
                        </div><!-- /.modal-content -->
                    </div><!-- /.modal-dialog -->
                </div><!-- /.modal -->
            </div>
        </div>

        <div class="modal fade" id="myModalHistory" role="dialog" aria-labelledby="myModalLabelHistory"
             aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                        <h4 class="modal-title" id="myModalLabelHistory"></h4>
                    </div>
                    <div class="modal-body">
                        <p id="myModalHistoryContent"></p>
                    </div><!-- /.modal-content -->
                </div><!-- /.modal-dialog -->
            </div><!-- /.modal -->
        </div>
    </div>
{% endblock %}
{% block bodyjs %}
    <script src="/static/js/jquery.dataTables.js"></script>
    {{ django_context_varable }}
    {% verbatim %}
    <script id="tpl" type="text/x-handlebars-template">
        {{#each func}}
        <button type="button" class="btn btn-{{this.type}} btn-sm" onclick="{{this.fn}}">{{this.name}}</button>
        {{/each}}
    </script>
    {% endverbatim %}
    <script src="/static/js/handlebars-v3.0.1.js"></script>
    <script src="/static/js/shell_assets_reception.js?t=20190729001"></script>
    <script src="/static/js/dataTables.colVis.js"></script>
{% endblock %}
{% block css %}
    <link href="/static/css/jquery.dataTables.css" rel="stylesheet" type="text/css">
    <link href="/static/css/mycss.css" rel="stylesheet" type="text/css">
    <link href="/static/css/dataTables.colVis.css" rel="stylesheet" type="text/css">
{% endblock %}
